package huoye.shops.huoye.operation.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.math.BigDecimal;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.base.APIUrls;
import huoye.shops.huoye.operation.model.CurUserLotteryInfos;
import huoye.shops.huoye.operation.model.SellOrder;
import huoye.shops.utils.StockUtils;
import huoye.shops.widget.RoundImageView;


/**
 * Created by uesr on 2018/8/10.
 */

public class CurUserLotteryInfosAdapter extends RecyclerViewAdapter<CurUserLotteryInfosAdapter.ViewHolder,CurUserLotteryInfos> {



    public CurUserLotteryInfosAdapter(Context context) {
        super(context, R.layout.item_winning_info);
    }

    @Override
    protected ViewHolder initViewHolder(View view, int i) {

        return new ViewHolder(view);
    }


    @Override
    protected void bindView(ViewHolder holder, final CurUserLotteryInfos infos, int i) {

        if(infos.isGet()){
            holder.tvWinningState.setVisibility(View.VISIBLE);
        }

        if(getContext() != null){
            Glide.with(getContext())
                    .load(infos.getHeadImg())
                    .dontAnimate()
                    .placeholder(R.mipmap.ic_wait_logo)
                    .error(R.mipmap.ic_error)
                    .into(holder.ivWinningInfo);
        }
        holder.tvWinningTel.setText(infos.getMobile());
        holder.tvWinningName.setText(infos.getNickName()+"获得"+infos.getPrizeTitle()+"奖品"+infos.getNum()+"份");








    }


    public class ViewHolder extends RecyclerViewAdapter.ViewHolder {

        @BindView(R.id.item_winning_info_tv_name)
        TextView tvWinningName;
        @BindView(R.id.item_winning_info_tv_tel)
        TextView tvWinningTel;
        @BindView(R.id.item_winning_info_tv_state)
        TextView tvWinningState;
        @BindView(R.id.item_winning_info_iv)
        ImageView ivWinningInfo;

        public ViewHolder(View itemView) {
            super(itemView);
        }
    }



/*    public void setOnSellOrderListener(OnSellOrderListener onSellOrderListener) {
        this.listener = onSellOrderListener;
    }

    private OnSellOrderListener listener;

    public interface OnSellOrderListener {

        void onDetailsClick(SellOrder sellOrder);
        void onDeleteClick(SellOrder sellOrder);
        void onSendClick(SellOrder sellOrder);

    }*/

}
